class DeptTreeInfo {
  List<DeptTreeInfo> children;
  String icon;
  int id;
  String label;
  int parentId;
  String parentName;

  bool isShow;
  bool isExpand;
  int level;
  bool isSelect;

  DeptTreeInfo(
      {this.children,
      this.icon,
      this.id,
      this.label,
      this.parentId,
      this.parentName,
      this.isShow = false,
      this.isExpand = false,
      this.level,
      this.isSelect  = false});

  factory DeptTreeInfo.fromJson(Map<String, dynamic> json) {
    return DeptTreeInfo(
      children: json['children'] != null
          ? (json['children'] as List)
              .map((i) => DeptTreeInfo.fromJson(i))
              .toList()
          : null,
      icon: json['icon'],
      id: json['id'],
      label: json['label'],
      parentId: json['parentId'],
      parentName: json['parentName'],
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['icon'] = this.icon;
    data['id'] = this.id;
    data['label'] = this.label;
    if (this.children != null) {
      data['children'] = this.children.map((v) => v.toJson()).toList();
    }
    if (this.parentId != null) {
      data['parentId'] = this.parentId;
    }
    if (this.parentName != null) {
      data['parentName'] = this.parentName;
    }
    return data;
  }
}
